#include "BookStoreClass.h"

MyBookStore::MyBookStore()
{
    index=0;
    StoreName="";
}

MyBookStore::MyBookStore(string storey)
{
    index = 0;
    StoreName=storey;
}

void MyBookStore::AddBook(Book ab)
{
//    Book mad(m,n,o,p);

    
    MyArray[index] = ab;
     index++;   

}
string MyBookStore::DisplayTitle(int ja)
{
    return MyArray[ja].BookName;
}

Book MyBookStore::SearchTitle(string jo)
{
    for (int tie=0; tie < 25; tie ++)
    {
    
        if(MyArray[tie].BookName==jo)
        {
            return MyArray[tie];
        }
         
    }
    cout << "No Value" << endl;
    return Output;

}

Book MyBookStore::SearchAuthor(string ji, string ju)
{
    for (int tied=0; tied < 25; tied ++)
    {
        if(MyArray[tied].AuthorFirst==ji)
        {
            if(MyArray[tied].AuthorLast==ju)
            {
                return MyArray[tied];
            }
        }
    }
    cout << "No Value" << endl;
    return Output;
}

Book MyBookStore::DeleteBook(int jojo)
{
    Book Sold;
    Sold = MyArray[jojo];
    MyArray[jojo] = Output;
    for (jojo; jojo < 24; jojo++)
    {
        MyArray[jojo] = MyArray[jojo+1];
    } 
    index--;
    return Sold;
}
